<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../../assets/libs/jquery/jquery-3.6.1.min.js"></script>
</head>

<body>
  <ul>
    <li>Hello world!</li>
    <li>Hello world! 2</li>
    <li>Hello world! 3</li>
    <li>Hello world! 4</li>
    <li>Hello world! 5</li>
    <li>Hello world! 6</li>
    <li>Hello world! 7</li>
  </ul>

  <script>
    // 遍历 jQuery 元素
    $('li').each((index, elem) => {
      console.log(index, elem)
    })

    // 遍历可遍历对象
    const arr = ['A', 'B', 'C', 'D', 'E']
    $.each(arr, (index, elem) => {
      console.log(index, elem)
    })
  </script>
</body>

</html>